function showOrgs() {
    var motcle = "" + $("#search_i").val();
    var city = $("#city").val();
    var subrub = $("#subrub").val();
    makeSearch(motcle, city, subrub, "");
}

function showOrgsByLetter(letter) {
    var city = $("#city").val();
    var subrub = $("#subrub").val();
    makeSearch("", city, subrub, letter);
}

function showDetails(ido) {
    var DATA = {};
    DATA["ido"] = '' + ido;
    $("#test_content").html("");
    $("#loading3").show();
    $.ajax({
        type: "POST",
        url: "/Symfony2/web/app_dev.php/details",
        data: DATA,
        cache: false,
        success: function(data) {
            $("#test_content").html(data);
            $('#test_content').fadeIn('slow');
            $("#loading3").hide();
        }
    });
    return false;
}

function getMoreOrgs(offset) {
    var DATA = {};
    DATA["offset"] = '' + offset;
    $("#loading2").show();
    $.ajax({
        type: "POST",
        url: "/Symfony2/web/app_dev.php/moreorgs",
        data: DATA,
        cache: false,
        success: function(data) {
            $("#data_result_more"+offset).html(data);
            $("#loading"+offset).hide();
        }
    });
    return false;
}

function makeSearch(motcle, city, subrub, letter) {
    $("#loading0").show();
    $('#data_result').fadeOut('slow');
    var DATA = {};
    DATA["motcle"] = '' + motcle;
    DATA["city"] = '' + city;
    DATA["subrub"] = '' + subrub;
    DATA["letter"] = '' + letter;

    $.ajax({
        type: "POST",
        url: "/Symfony2/web/app_dev.php/search",
        data: DATA,
        cache: false,
        success: function(data){
            $('#data_result').html(data);
            $('#data_result').fadeIn('slow');
            $("#loading0").hide();
        }
    });
    return false;
}

function makeSearch_() {
    $('#search_i').keyup(function(e) {
        var motcle = $("#search_i").val();
        if(e.keyCode==13){
            if ((motcle != '')) {
                makeSearch(motcle, "", "");
            }
        }
    });
}